/**
 * 
 */
package edu.hm.compiler.interpreter.renamer;

import java.util.ArrayList;
import java.util.List;

import edu.hm.compiler.parser.grammar.Query;
import edu.hm.compiler.parser.grammar.predicate.Predicate;

/**
 * @author Korny
 */
public class QueryRenamer extends Renamer< Query >
{

    /**
     * @param predicate
     * @param query
     */
    public QueryRenamer( final Query query )
    {
        super( query );
    }

    /**
     * @return
     */
    @Override
    public Query rename()
    {
        final List< Predicate > predicateList = this.getRuleOrQuery().getPredicateList();
        final List< Predicate > newBody = new ArrayList<>();
        for( final Predicate p: predicateList )
            newBody.add( this.renamePredicate( p ) );

        final Query newRule = new Query( newBody );

        return newRule;
    }
}
